package com.feri.fitness.cs.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.feri.fitness.cs.domain.MoodComment;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 千锋郑州Java学科欢迎你
 * @program: Fitness
 * @description: 持久层 定义操作数据库的方法
 * @author: Feri
 * @create: 2023-01-12 08:59:28
 */
public interface MoodCommentDao extends BaseMapper<MoodComment> {

    @Select("select mc.*,mcc.num from t_mood_comment mc left join  (select count(*) num,parentid from t_mood_comment where parentid>0 group by parentid) mcc on mc.id=mcc.parentid\n" +
            "where mc.mid=#{mid} and mc.parentid=0;")
    List<MoodComment> selectByMid(int mid);
}